package gmu.xytxl.dao.impl;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import gmu.xytxl.bean.Yhxx;
import gmu.xytxl.dao.IYhxxDAO;
import gmu.xytxl.util.JDBCUtils;

public class YhxxDAOImpl implements IYhxxDAO {

	@Override
	public List<Yhxx> findAllYhxx() {
		String sql = "select * from yhxx";
		
		ResultSet rs = JDBCUtils.findAll(sql, null);
		
		List<Yhxx> list = new ArrayList<>();
		try {
			while (rs.next()) {
				Yhxx yhxx = new Yhxx();
				yhxx.setYhm(rs.getString("yhm"));
				yhxx.setPicture(rs.getString("picture"));
				list.add(yhxx);
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		JDBCUtils.closeConnection(rs, JDBCUtils.preparedStatement, JDBCUtils.conn);
		return list;
	}

}
